package com.hmall.user.filter;

import com.hmall.common.context.BaseContext;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class ProjectHandler implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
        //获取请求参数authorization
        String userId = request.getHeader("authorization");
        //将请求参数存放到ThreadLocal中
        BaseContext.setCurrentId(2L);

        return true;
    }
}
